class Solution
{
public:
    vector<int> countOfPairs(int n, int x, int y)
    {
        auto dist = [&](int i, int j)
        {
            return abs(i - j);
        };
        auto distWithShortcut = [&](int i, int j)
        {
            int result = dist(i, j);
            result = min(result, dist(i, x) + dist(j, y) + 1);
            result = min(result, dist(i, y) + dist(j, x) + 1);
            return result;
        };
        vector<int> result(n, 0);
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                if (i == j)
                {
                    continue;
                }
                result[distWithShortcut(i, j) - 1]++;
            }
        }
        return result;
    }
};